import socket

server = socket.socket()
host = socket.gethostname()
port = 3883
server.bind((host,port))
server.listen(5)

while True:
    print('等待连接 ')
    cli,addr = server.accept()
    print('client',addr,'已连接')
    cli.send(bytearray('i am server','utf-8'))
    print(cli.recv(1024))
    print(type(cli.recv(256)))
    cli.close()